<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	    <meta name="format-detection" content="telephone=no">
	    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
	    <link href="../../css/bootstrap.css" rel="stylesheet" />
	    <link href="../../css/cover.css" rel="stylesheet" />
	    <link href="../../css/font-awesome.min.css" rel="stylesheet" />
	    <title>创建社区</title>
	    <script src="../../js/jquery-2.2.3.min.js"></script>
	    <script src="../../js/jquery.flexslider-min.js"></script>
	    <script src="../../js/rem.js"></script>
	    <script src="../../js/itnetcao.js"></script>
	    <link href="../../js/layui/css/layui.css" rel="stylesheet" />
	    <link href="../../js/donghua/animsition.min.css" rel="stylesheet" />
	    <script src="../../js/donghua/animsition.min.js"></script>
	    <link rel="stylesheet" href="../../css/minirefresh.css" />
	    <link rel="stylesheet" href="../../css/common.css" />
	    <script type="text/javascript" src="../../js/minirefresh.js"></script>
	    <script type="text/javascript" src="../../js/common.js"></script>
	    <script type="text/javascript" src="../../js/layer.js"></script>
		<style type="text/css">
		*{
			margin: 0px;
			padding: 0px;
			font-family:"微软雅黑"
		}
		</style>
	</head>
	<body>
		<div class="page_top01 relative">
            <h3 class="text-center">社区创建</h3>
            <a href="javascript:;" class="animsition-link" data-animsition-out-class="fade-out-right" data-animsition-out-duration="500" onclick="history.go(-1)">
                <img src="../../images/icon_left.png" class="img-responsive reture_img" /></a>
        </div>
		<div class="layui-fluid layui-form layui-form-pane">
			<div class="layui-row layui-col-space15">
				
				<div class="layui-col-xs12">
					<div class="layui-form-item">
					    <label class="layui-form-label">名称</label>
					    <div class="layui-input-block">
							<input type="text" name="coName" autocomplete="off" placeholder="请输入社区名称" class="layui-input">
					    </div>
					</div>
				</div>
				
				<div class="layui-col-xs12">
					<div class="layui-form-item">
					    <label class="layui-form-label">宣言</label>
					    <div class="layui-input-block">
							<input type="text" name="coContext" autocomplete="off" placeholder="请输入社区宣言" class="layui-input">
					    </div>
					</div>
				</div>
				<div class="layui-col-xs12" style='margin-top:5%;'>
					<button class='layui-btn layui-btn-warm saveOrUpdate' style='width:100%;'>保存</button>
				</div>
			</div>
		</div>
	
<script type='text/javascript'>
var userId = jQuery.parseJSON(localStorage.getItem("miningmachine_user")).userId;
$(function() {
	
	$(".saveOrUpdate").click(function() {
		if($("input[name='coName']").val().trim().length == 0) {
			alert("您必须输入社区名称.");
			return;
		}
		if($("input[name='coContext']").val().trim().length == 0) {
			alert("您必须输入社区宣言.");
			return;
		}
		
		var url = localStorage.getItem("url") + "/user/controller/UserCreateCommunityAPP.do";
		
		var data = "coUserId=" + userId + "&coName=" + $("input[name='coName']").val().trim() + "&coContext=" + $("input[name='coContext']").val().trim();
		
		itcao.itGetAjaxTrueBigData(url, data).done(function(result) {
			var json = jQuery.parseJSON(result);
			if(json.state == true){
				alert("创建成功.");
			}else {
				alert("创建失败:" + json.value);
			}
		})
	})
	
})
</script>
</body>
</html>
